home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_show / cecil / example3 / example.e < prev    next >
Encoding:
Text File  |  1997-04-13  |  775 b   |  40 lines  |  [TEXT/ttxt]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class EXAMPLE
  5.    --
  6.    -- The Eiffel program is running first, then call the C program 
  7.    -- which is in charge to print the contents of `animals' using
  8.    -- `lower'/`upper'/`item' of ARRAY[ANIMAL].
  9.    --
  10.    -- To compile this example, use command :
  11.    --   
  12.    --         compile -cecil cecil.se example c_prog.c
  13.    --
  14.  
  15. creation make
  16.  
  17. feature
  18.  
  19.    make is
  20.       local
  21.      cat: CAT;
  22.      dog: DOG;
  23.       do
  24.      !!cat;
  25.      !!dog;
  26.      animals := <<cat,dog,cat>>;
  27.      call_c_prog(animals.to_pointer);
  28.       end;
  29.  
  30. feature {NONE}
  31.  
  32.    animals: ARRAY[ANIMAL];
  33.  
  34.    call_c_prog(animals_ptr: POINTER) is
  35.       external "C"
  36.       alias "c_prog"
  37.       end;
  38.  
  39. end -- EXAMPLE
  40.